var exp = module.exports;
var dispatcher = require('./dispatcher');

exp.fight = function(session, msg, app, cb)
{
	var servers = app.getServersByType('fight');
	if(!servers || servers.length === 0)
    {
		cb(new Error('can not find fight servers.'));
		return;
	}
    var uid = session.uid;
	var res = dispatcher.dispatch(uid,servers);
    console.info('%d@%s',uid,res.id);
	cb(null, res.id);
};